<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-model-item label="部门" prop="titleName">
              <j-input v-model="queryParam.deptName"></j-input>
            </a-form-model-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-model-item label="所属公司" prop="company">
              <j-dict-select-tag
                style="z-index: 33;"
                v-model="queryParam.company"
                dictCode="company_code"
                placeholder="请选择所属公司">
              </j-dict-select-tag>
            </a-form-model-item>
          </a-col>
          <a-col :md="5" :sm="8">
            <a-form-item label="日期">
              <a-month-picker style="width: 100%;" v-model="queryParam.ssny" placeholder="请选择年月"/>
              <!-- <a-month-picker v-model="queryParam.date" placeholder="请选择年月"/> -->
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 modalForm-->
    <div class="table-operator">
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
        :dataSource="dataSource" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="withdrawalNum" slot-scope="text, record">
          <a @click="checkHandle(record)">{{record.withdrawalNum}}</a>
        </span>
      </a-table>
    </div>
    <AssetCheck-modal ref="modalForm" @ok="modalFormOk"></AssetCheck-modal>

  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import AssetCheckModal from './modules/AssetCheckModal'
import moment from 'moment'

export default {
  name: 'AssetCheckList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    AssetCheckModal
  },
  data() {
    return {
      queryParam:{
        ssny:moment(new Date()).format('YYYY-MM')
      },
      isAudit:0,
      searchOptions:[{
          text:"全部",
          value:"1"
        },{
          text:"在职",
          value:"2"
        },{
          text:"离职",
          value:"3"
      }],
      // 表头
      columns: [
        {
          title: '抽盘单据编号',
          align: "center",
          dataIndex: 'billNo'
        },
        {
          title: '公司名称',
          align: "center",
          dataIndex: 'companyName'
        },
        {
          title: '部门名称',
          align: "center",
          dataIndex: 'deptName'
        },
        {
          title: '抽盘数量',
          align: "center",
          dataIndex: 'withdrawalNum',
          scopedSlots: { customRender: 'withdrawalNum' }
        },
        {
          title: '异常数量',
          align: "center",
          dataIndex: 'badNum'
        },
        {
          title: '盘点人',
          align: "center",
          dataIndex: 'inventoryUser'
        },
        {
          title: '状态',
          align: "center",
          dataIndex: 'status',
          customRender: function (text) {
              if (text === '1') {
                return '进行中'
              } else if (text === '2') {
                return '已结束'
              } else {
                return text
              }
            }
          },
        {
          title: '抽盘创建时间',
          align: "center",
          dataIndex: 'createTime'
        }
      ],
      url: {
        list: "/assets/assetsRandomStock/list",
        delete: "/sys/user/delete",
      },
    }
  },
  created() {
  },
  computed: {
  },
  methods: {
    checkHandle(record){
      this.$refs.modalForm.edit(record);
      this.$refs.modalForm.title = "详情";
      this.$refs.modalForm.disableSubmit = false;
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>